home *** CD-ROM | disk | FTP | other *** search
- % Some useful extension macros for LaTex.
- %
- % --- ------------------------------------------------------------------
- % --- English-style Date Macros for LaTeX, version 1.00--0.
- % --- ------------------------------------------------------------------
- %
- % --- \today (replaces American-style macro of same name) generates
- % --- today's date in the form 4th October 1066.
- % --- The `th' is raised, reduced in size and underlined in the
- % --- same font style (family) as the rest of the date.
- % \today* generates today's date in brief form 4-Oct-1066.
- %
- % --- \st generates a raised, reduced, underlined `st', as in 1st.
- % --- \nd generates a raised, reduced, underlined `nd', as in 2nd.
- % --- \rd generates a raised, reduced, underlined `rd', as in 3rd.
- % --- \th generates a raised, reduced, underlined `th', as in 4th.
- %
- % --- \dayofweek generates the day of the week, based on TeX's values
- % --- of \day, \month and \year.
- %
- % --- Counters. Note that we use the same registers as TeX holds other
- % --- things in (e.g., \count0 holds the page number). This requires
- % --- that \@savestyle, \@setstyle & \dayofweek perform
- % --- all their register manipulations within a group. This may seem
- % --- a bit messy, but it saves having registers permanently set
- % --- aside just for date calculation.
-
- \def\@dow{\count2 } % gets day of the week
- \def\@leap{\count5 } % leap year fingaler
- \def\@x{\count6 } % temp register
- \def\@y{\count7 } % another temp register
-
-
- % --- A replacement for the ``plain'' TeX and LaTeX \today macro, to
- % --- to output the date in English-style.
- % --- They ensure the smaller text comes out in the right font by saving
- % --- the font family before reducing the size, then restoring it. (This
- % --- was suggested by Leslie Lamport.) Of course, it requires that the
- % --- font in use when today is invoked has a sensible family.
-
- \def\@up#1{{\@savestyle\thinspace$^{\underline{\hbox{%
- \scriptsize\@setstyle#1\fam=-1 }}}$}}
- \def\st{\@up{st}}
- \def\nd{\@up{nd}}
- \def\rd{\@up{rd}}
- \def\th{\@up{th}}
-
- % --- Macros to save and restore the font family.
-
- \def\@savestyle{\count0=\the\fam}
- \def\@setstyle{\ifcase\count0\rm\or\mit\or\cal\or\rm% what's family 3?
- \or\it\or\sl\or\bf\or\tt\fi}
-
- % --- The date, English style (e.g. 4th October 1066) (\today)
- % or brief style (e.g. 4-Oct-1066) (\today*)
-
- \def\today{\@ifstar%
- {\number\day-\ifcase\month\or Jan\or Feb\or Mar \or Apr\or May\or Jun\or
- Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi-\number\year}
- {\number\day\ifcase\day
- \or\st\or\nd\or\rd\or\th\or\th\or\th\or\th\or\th\or\th\or\th
- \or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th
- \or\st\or\nd\or\rd\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\st\fi
- \space\ifcase\month\or January\or February\or March\or April\or May\or
- June\or July\or August\or September\or October\or November\or December\fi
- \space\number\year}}
-
- % --- The day of the week ("Sunday", etc.) is inserted into the text
- % --- by \dayofweek. (This uses registers \@dow, \@leap, \@x and \@y.)
- % --- I acquired this from elsewhere; I don't know who wrote it.
-
- \def\dayofweek{{%
- % leap = year + (month - 14)/12;
- \@leap=\month \advance\@leap by -14 \divide\@leap by 12
- \advance\@leap by \year
- % dow = (13 * (month + 10 - (month + 10)/13*12) - 1)/5
- \@dow=\month \advance\@dow by 10
- \@y=\@dow \divide\@y by 13 \multiply\@y by 12
- \advance\@dow by -\@y \multiply\@dow by 13 \advance\@dow by -1 \divide\@dow by 5
- % dow += day + 77 + 5 * (leap % 100)/4
- \advance\@dow by \day \advance\@dow by 77
- \@x=\@leap \@y=\@x \divide\@y by 100 \multiply\@y by 100 \advance\@x by -\@y
- \multiply\@x by 5 \divide\@x by 4 \advance\@dow by \@x
- % dow += leap / 400
- \@x=\@leap \divide\@x by 400 \advance\@dow by \@x
- % dow -= leap / 100 * 2;
- % dow = (dow % 7)
- \@x=\@leap \divide\@x by 100 \multiply\@x by 2 \advance\@dow by -\@x
- \@x=\@dow \divide\@x by 7 \multiply\@x by 7 \advance\@dow by -\@x
- \ifcase\@dow Sunday\or Monday\or Tuesday\or Wednesday\or
- Thursday\or Friday\or Saturday\fi}}
- %
- %-------------------------------------------------------------------------
- % CRL Extensions to LaTeX
- %
- %\typeout{CRDS Extensions to LaTeX, V1.1. (RL Aurbach, 09-Sep-1986)}
- %
- %****************************************************************************
- %* *
- %* Outline Environment *
- %* *
- %* Description: *
- %* The outline environment is a modified enumerate environment in *
- %* which the numbering is done using standard outlining conventions. *
- %* *
- %* Syntax: *
- %* \begin{outline} \item text \end{outline} *
- %* *
- %****************************************************************************
- %
- \@definecounter{outlni} \@definecounter{outlnii} \@definecounter{outlniii}
- \@definecounter{outlniv} \@definecounter{outlnv}
- \newcount\@outlndepth \@outlndepth =0
-
- \def\outline{\ifnum \@outlndepth >4 \@toodeep \else \advance\@outlndepth\@ne
- \edef\@outlnctr{outln\romannumeral\the\@outlndepth}\list
- {\csname label\@outlnctr\endcsname}{\usecounter{\@outlnctr}
- \def\makelabel##1{\hss\llap{##1}}}\fi}
- \let\endoutline =\endlist
-
- \def\labeloutlni{\Roman{outlni}.} \def\theoutlni{\Roman{outlni}}
- \def\labeloutlnii{\Alph{outlnii}.} \def\theoutlnii{\Alph{outlnii}}
- \def\labeloutlniii{\arabic{outlniii}.} \def\theoutlniii{\arabic{outlniii}}
- \def\labeloutlniv{\alph{outlniv}.} \def\theoutlniv{\alph{outlniv}}
- \def\labeloutlnv{(\roman{outlnv})} \def\theoutlnv{\roman{outlnv}}
- \def\p@outlnii{\theoutlni.} \def\p@outlniii{\p@outlnii\theoutlnii.}
- \def\p@outlniv{\p@outlniii\theoutlniii.}\def\p@outlnv{\p@outlniv\theoutlniv.}
-
- %
- %****************************************************************************
- %* *
- %* InfoMap Environment *
- %* *
- %* Description: *
- %* The infomap environment is a modified description environment in *
- %* which the label is set off from the text as a signpost. The *
- %* signpost is implemented in a \parbox to allow for a multi-line *
- %* label. *
- %* *
- %* Syntax: *
- %* \begin{infomap} \item[label] text \end{infomap} *
- %* *
- %* Where: *
- %* label is the text to be placed in the Signpost at the current *
- %* left margin. *
- %* *
- %* Note: *
- %* The signpost is implemented as a \parbox set in a \raisebox which *
- %* has a depth of 0pt. This is necessary to make a multi-line sign- *
- %* work correctly, but occasionally, you will need to add extra *
- %* vertical space if the signpost occupies more lines than the text. *
- %* *
- %****************************************************************************
- %
- \newdimen\infomapmargin
- \newdimen\infomapwidth
-
- \infomapmargin 115pt
- \infomapwidth 103pt
- \def\infomaplabel#1{\raisebox{0pt}[1em][0pt]{\makebox[\labelwidth][l]
- {\parbox[t]{\infomapwidth}{\bf #1}}}}
- \def\infomap{\list{}{\leftmargin\infomapmargin
- \labelwidth\leftmargin\advance\labelwidth-\labelsep
- \let\makelabel\infomaplabel}}
- \let\endinfomap\endlist
- \def\ttitem[#1]{\item[{\tt #1}]}
-
- %
- %****************************************************************************
- %* *
- %* Note Environment *
- %* *
- %* Description: *
- %* The note environment is a modified version of the quote environment.*
- %* It is distinctive in that it has a centered title for the note *
- %* prior to the beginning of the text. The title may be specified, *
- %* using the optional argument. If no title is specified, the title *
- %* "Note" is used. *
- %* *
- %* Syntax: *
- %* \begin{note}[title] text \end{note} *
- %* *
- %* Where: *
- %* title is the text to be used as the title. If not specified *
- %* "Note" is used. The title is centered above the text, *
- %* in boldface. *
- %* *
- %* Note: *
- %* It is possible for the title and text of a note to be separated *
- %* across a page break. So far, I haven't been able to discover a *
- %* fool-proof way to prevent this from occurring, so check the output. *
- %* *
- %****************************************************************************
- %
- \def\note{\@ifnextchar [{\@note}{\@note[Note]}}
- \def\@note[#1]{\par \list{}{\leftmargin 2em \rightmargin\leftmargin }
- \item[] \hfil {\bf #1} \hfil \par \item[]}
- \let\endnote\endlist
-
- %
- %****************************************************************************
- %* *
- %* Ctl Command *
- %* *
- %* Description: *
- %* The \ctl command is used to place a representation of a control *
- %* character in the document. \ctl{x} is represented as ^x. *
- %* *
- %* Syntax: *
- %* \ctl{ch} *
- %* *
- %* Where: *
- %* ch is the character to be represented. *
- %* *
- %* Note: *
- %* The character is displayed in \tt. *
- %* *
- %****************************************************************************
- %
- \def\ctl#1{{\tt $^\wedge$#1}}
-
- %
- %****************************************************************************
- %* *
- %* Trademark Command *
- %* *
- %* Description: *
- %* This command generates a trademark symbol (an R in a circle). The *
- %* symbol is normally used as "foo$^\trademark$". *
- %* *
- %* Syntax: *
- %* \trademark *
- %* *
- %* Note: *
- %* Thanks to Kent McPherson of Lear/Siegler for this command. *
- %* *
- %****************************************************************************
- %
- \def\trademark{{\ooalign
- {\tiny \hfill \raise .085ex\hbox{R}\hfill \crcr
- \scriptsize \mathhexbox20D}}}
-
- %
- %****************************************************************************
- %* *
- %* ULine Command *
- %* *
- %* Description: *
- %* The \uline command is used to underline text. Unlike the *
- %* \underline command, \uline provides the user with the ability to *
- %* control the thickness of the line. *
- %* *
- %* Syntax: *
- %* \uline{text}{thickness} *
- %* *
- %* Where: *
- %* text is the text which will be underlined. *
- %* *
- %* thickness is the thickness of the line. This dimension is *
- %* typically .3pt --.5pt. *
- %* *
- %* Note: *
- %* Thanks to Kent McPherson of Lear/Siegler for this command. *
- %* *
- %****************************************************************************
- %
- \newlength{\ulength}
- \newcommand{\uline}[2]{\settowidth{\ulength}{#1}
- \parbox{\ulength}{{#1} \\[-.75\baselineskip] \rule{\ulength}{#2}}}
-
- %
- %****************************************************************************
- %* *
- %* ClearDoublePage Command *
- %* *
- %* Description: *
- %* This command is a modification of the standard LaTeX command of the *
- %* same name. Unlike standard LaTeX, this command uses the "empty" *
- %* pagestyle for the blank page it throws, so that the page is totally *
- %* blank. *
- %* *
- %* Syntax: *
- %* \cleardoublepage *
- %* *
- %****************************************************************************
- %
- \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
- \if@twocolumn\hbox{}\newpage\fi\hbox{}\thispagestyle{empty}\newpage\fi\fi}
-
- %
- %****************************************************************************
- %* *
- %* ForceRightPage Command *
- %* *
- %* Description: *
- %* The \forcerightpage command is a variant on the \cleardoublepage *
- %* command. It conditionally throws a blank page to force the text *
- %* which follows to appear on a right-hand page. The blank page will *
- %* contain an optional, centered message. *
- %* *
- %* Syntax: *
- %* \forcerightpage[text] *
- %* *
- %* Where: *
- %* text is the text to be displayed centered on the page. If *
- %* not specified, "This page intentionally left blank" *
- %* is used. *
- %* *
- %* Note: *
- %* This command will not correctly handle a two-column document and *
- %* should not be used in that environment. *
- %* *
- %****************************************************************************
- %
- \def\forcerightpage{\@ifnextchar [{\@forcerightpage}
- {\@forcerightpage[This page intentionally left blank]}}
- \def\@forcerightpage[#1]{\clearpage\if@twoside \ifodd\c@page\else
- \hbox{} \vfill \centerline{#1} \vfill \newpage\fi\fi}
-
- %
- %****************************************************************************
- %* *
- %* ForceLeftPage Command *
- %* *
- %* Description: *
- %* The \forceleftpage command is a variant on the \cleardoublepage *
- %* command. It conditionally throws a blank page to force the text *
- %* which follows to appear on a left-hand page. The blank page will *
- %* contain an optional, centered message. *
- %* *
- %* Syntax: *
- %* \forceleftpage[text] *
- %* *
- %* Where: *
- %* text is the text to be displayed centered on the page. If *
- %* not specified, "This page intentionally left blank" *
- %* is used. *
- %* *
- %* Note: *
- %* This command will not correctly handle a two-column document and *
- %* should not be used in that environment. *
- %* *
- %****************************************************************************
- %
- \def\forceleftpage{\@ifnextchar [{\@forceleftpage}
- {\@forceleftpage[This page intentionally left blank]}}
- \def\@forceleftpage[#1]{\clearpage \if@twoside \ifodd\c@page
- \hbox{} \vfill \centerline{#1} \vfill \newpage\fi\fi}
-
- %
- %****************************************************************************
- %* *
- %* Input Command *
- %* *
- %* Description: *
- %* The \input command is a variation of the standard LaTeX command of *
- %* the same name. It reads in an external file. It differs from the *
- %* normal LaTeX command in that if the specified file is not found, *
- %* the routine displays a message and continues, rather than prompting *
- %* for a new file name. *
- %* *
- %* Syntax: *
- %* \input{file} *
- %* *
- %* Where: *
- %* file is the file specification of the input file to be read. *
- %* By default, the file has the file type ".tex" unless *
- %* specified otherwise. If the file is not found in the *
- %* current default directory, it will be searched for in *
- %* TEX$INPUTS. *
- %* *
- %****************************************************************************
- %
- \def\input{\@ifnextchar \bgroup{\@input}{\@@input }}
-
- %
- %****************************************************************************
- %* *
- %* CoverStyle Command *
- %* *
- %* Description: *
- %* This routine defines a cover style for a document. It reads in a *
- %* ".cvrsty" file, which contains the necessary information. *
- %* *
- %* Syntax: *
- %* \coverstyle{name} *
- %* *
- %* Where: *
- %* name is the name of a coverstyle. The file name.cvrsty will *
- %* be input. *
- %* *
- %****************************************************************************
- %
- \def\coverstyle#1{\def\@coverstyle{#1}
- \makeatletter \input \@coverstyle.cvrsty \relax \makeatother}
-
- %
- %****************************************************************************
- %* *
- %* ScreenPix Environment *
- %* *
- %* Description: *
- %* The screenpix environment is used to display the image of a screen *
- %* in a document. A curved line is drawn at the top, which represents *
- %* the beginning of the screen. After the verbatim text, another line *
- %* is drawn at the bottom to represent the bottom of the screen. *
- %* *
- %* Lines up to 80 characters long may appear. You should place a *
- %* leading space at the beginning of each line, so that the text will *
- %* not overwrite the curved lines. Since tabs are not expanded in *
- %* verbatim mode, they should be explicitly converted to spaces. *
- %* *
- %* Syntax: *
- %* \begin{screenpix} *
- %* \begin{verbatim} *
- %* lines of verbatim screen-image text *
- %* \end{verbatim} *
- %* \end{screenpix} *
- %* *
- %* Where: *
- %* The lines of verbatim text may be up to 80 characters long, not *
- %* counting the REQUIRED leading space on each line. *
- %* *
- %* Note: *
- %* This environment assumes that a text width of 6 inches is available *
- %* for the display of the screen. *
- %* *
- %****************************************************************************
- %
- \def\screenpix{\small \setlength{\unitlength}{1in} \thicklines
- \begin{picture}(6,.35) \put(3,0){\oval(6,.7)[t]} \end{picture}\par
- \vspace*{-3\parskip}}
- \def\endscreenpix{\vspace*{-3\parskip}
- \begin{picture}(6,.35) \put(3,.35){\oval(6,.7)[b]} \end{picture}}
-
- %
- %****************************************************************************
- %* *
- %* Glossaryfile Command *
- %* *
- %* Description: *
- %* This command is used to specify one or more Glossary Definition *
- %* files which will be searched for glossary definitions by GloTeX. *
- %* *
- %* Syntax: *
- %* \glossaryfile{filelist} *
- %* *
- %* Where: *
- %* filelist is a file specification of a .gdf file or a comma-list *
- %* of file specifications. *
- %* *
- %* Note: *
- %* This command writes a \glofile command to the .glo file *
- %* *
- %****************************************************************************
- %
- \def\glossaryfile#1{\if@filesw\write\@glossaryfile{\string
- \glofile{#1}}\fi}
-
- %
- %****************************************************************************
- %* *
- %* InsertGlossary Command *
- %* *
- %* Description: *
- %* This command causes a .gls file to be read in and processed. *
- %* *
- %* Syntax: *
- %* \insertglossary *
- %* *
- %* Note: *
- %* The .gls file is assumed to have the same name as the root latex *
- %* source file. *
- %* *
- %****************************************************************************
- %
- \def\insertglossary{\@input{\jobname.gls}}
-
- %
- %****************************************************************************
- %* *
- %* InsertIndex Command *
- %* *
- %* Description: *
- %* This command causes an .ind file to be read in and processed. *
- %* *
- %* Syntax: *
- %* \insertindex *
- %* *
- %* Note: *
- %* The .ind file is assumed to have the same name as the root latex *
- %* source file. *
- %* *
- %****************************************************************************
- %
- \def\insertindex{\@input{\jobname.ind}}
- %
- %===========================================================================
- % RMCS MACROS
- %===========================================================================
- %
- %---------------------------------------------------------------------------
- % Ensure that the next page of text is on a recto page (i.e. an odd
- % numbered page). If the next page number is even, output a page with no
- % headings informing the reader that it is intentionally blank.
- % Originally intended to be used at the end of chapters in report style.
- %---------------------------------------------------------------------------
- \newcommand{\chapend}{\clearpage\ifodd\count0\else
- \markboth{}{}
- \vspace*{\fill}\centerline{\small This page is left intentionally blank}
- \vspace*{\fill}\cleardoublepage\fi}
- %
- %---------------------------------------------------------------------------
- % Allow the listing of programs in \tt font, with an approximation for
- % any embedded tabs.
- %---------------------------------------------------------------------------
- {\catcode`\^^I=\active
- \gdef\obeytabs{\catcode`\^^I=\active\let^^I=\quad}
- \global\let^^I\quad}
- \def\program{\begingroup\tt\obeylines\obeytabs}%
- \def\endprogram{\endgroup}
- %
- %---------------------------------------------------------------------------
- % Allow the selection of some or all modules of a large LaTeX document.
- % Very useful for PhD writers!
- %---------------------------------------------------------------------------
- \newcommand{\select}[1]
- {
- \typeout{ }
- \typeout{Files which may be included in this document are ... }
- \typeout{ }
- \typeout{\space\space\space\space#1}
- \typeout{ }
- \typeout{To include one file, type its name.}
- \typeout{To include some files, type the names separated by commas
- and NO spaces.}
- \typeout{To include all of the files, just hit RETURN.}
- \typeout{ }
- \typein[\inclusions]{Enter the files to be included: }
- \if\inclusions
- \endlinechar\relax
- \else
- \includeonly{\inclusions}
- \fi
- }
- %
- %--------------------------------------------------------------------------
- % Adapted from Aston University: FORTRAN.TEX
- %
- % This is a file of commands for printing out programs using TeX
- % -- see DIRTY TRICKS in TeXbook
- %
- % This version is designed to print source code at 9 point
- % fitting an 80 column line into a 6 true inch width with
- % 8 point line numbers before each line, except for \listing*
- % which doesn't have line numbers.
- % It handles TAB (^I) characters almost the same as DEC
- %
- % \listing{file.ext} % use dev:[dir] if you wish
- % \listing*{file.ext} % use dev:[dir] if you wish
- %
- % B.H. Toby 8/86
- % C.N. Kempson 22-NOV-1988
- %
- \newcount\lineno
- \font\Alisttt=cmtt9 at 9 truept
- \font\Alistrm=cmr8 at 8 truept
- \def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials}
-
- \def\listing{\@ifstar{\@listingnolinenos}{\@listingwithlinenos}}
- \def\@listingnolinenos#1{%
- \def\everyparaction{\llap{\ }\startbox}
- \par\begingroup\setupverbatim\input#1 \endgroup}
- \def\@listingwithlinenos#1{%
- \def\everyparaction{\advance\lineno by1 %
- \llap{\Alistrm\the\lineno\ \ }\startbox}
- \par\begingroup\setupverbatim\input#1 \endgroup}
-
- \def\setupverbatim{
- \Alisttt\baselineskip= 8.5truept\lineskip=1truept
- \lineskiplimit=1truept\topskip=0pt
- \lineno=0
- \def\par{\leavevmode\egroup\box0\endgraf}
- \obeylines \uncatcodespecials \obeyspaces
- \catcode`\`=\active \catcode`\^^I=\active
- \everypar{\everyparaction}
- }
- \newdimen\w \setbox0=\hbox{\Alisttt\space} \w=8\wd0
- \def\startbox{\setbox0=\hbox\bgroup}
- {\catcode`\^^I=\active
- \gdef^^I{\leavevmode\egroup
- \dimen0=\wd0
- \divide\dimen0 by\w
- \multiply\dimen0 by\w
- \advance\dimen0 by\w
- \wd0=\dimen0 \box0 \startbox}}
- {\obeyspaces\global\let =\ }
- {\catcode`\`=\active \gdef`{\relax\lq}}
- %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Met. Office (HERMES - D.Offiler) extensions...
- %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- \newcommand{\HERMES}{\mbox{\sl HERMES}}
- \newcommand{\ZEPHYR}{\mbox{$\cal ZEPHYR$}}
- \newcommand{\crest}{\special{ln03:plotfile tex$inputs:mocrest.sxl}}
- \newcommand{\smallcrest}{\special{ln03:plotfile tex$inputs:small_mocrest.sxl}}
-
- \arrayrulewidth 0.8pt % beef up the line widths in tabular & array envs.
-